﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml.Serialization;

namespace HugeFlow
{
    public enum ImageTypes { Square, Thumbnail, Small, Medium, Large, Original }

    public class FlickrPhoto
    {
        public string FarmID { get; set; }

        public string ServerID { get; set; }

        public string ID { get; set; }

        public string Secret { get; set; }

        public string Title { get; set; }

        public string OwnerName { get; set; }

        public string LargeImage { get { return GetImageURL(ImageTypes.Medium); } }

        public string ThumbnailImage { get { return GetImageURL(ImageTypes.Square); } }

        #region Method for ImageUrl
        public string GetImageURL(ImageTypes imageType)
        {
            string url = string.Format("http://farm{0}.static.flickr.com/{1}/{2}_{3}{4}.jpg",
                FarmID,
                ServerID,
                ID,
                Secret,
                GetStringByImageType(imageType));

            return url;
        }

        private string GetStringByImageType(ImageTypes imageType)
        {
            switch (imageType)
            {
                case ImageTypes.Square:
                    return "_s";
                case ImageTypes.Thumbnail:
                    return "_t";
                case ImageTypes.Small:
                    return "_m";
                case ImageTypes.Medium:
                    return "";
                case ImageTypes.Large:
                    return "_b";
                case ImageTypes.Original:
                    return "_o";
            }

            return "_s";
        }


        #endregion
    }
}
